package com.gwtjs.icustom.entity;

import java.io.Serializable;

import com.gwtjs.icustom.pojo.App;

/**
 * <h2>@description: DataSourceInfo 动态数据源信息，初始化ambari用
 * 
 * @author flash
 *
 */
public class DataSourceInfo implements Serializable{

	/**
	 */
	private static final long serialVersionUID = 3724706004984337063L;
	/** 主键 **/
	private String id_;
	// 数据源Code 连接池绑定ID
	private String dataSourceCode;
	// 数据源别名
	private String dataSourceName;
	// 数据源类型
	private String databaseType;
	// 数据库连接驱动
	private String driver;
	// 数据库连接
	private String dataSourceUrl;
	// 用户名
	private String username;
	// 用户密码
	private String password;

	public String getId_() {
		return id_;
	}

	public void setId_(String id_) {
		this.id_ = id_;
	}

	public String getDataSourceName() {
		return dataSourceName;
	}

	public void setDataSourceName(String dataSourceName) {
		this.dataSourceName = dataSourceName;
	}

	public String getDatabaseType() {
		return databaseType;
	}

	public void setDatabaseType(String databaseType) {
		this.databaseType = databaseType;
	}

	public String getDriver() {
		return driver;
	}

	public void setDriver(String driver) {
		this.driver = driver;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getDataSourceCode() {
		return dataSourceCode;
	}

	public void setDataSourceCode(String dataSourceCode) {
		this.dataSourceCode = dataSourceCode;
	}

	public String getDataSourceUrl() {
		return dataSourceUrl;
	}

	public void setDataSourceUrl(String dataSourceUrl) {
		this.dataSourceUrl = dataSourceUrl;
	}
	
	static public DataSourceInfo getDataSourceInfo(App app) {
		// String dataSourceUrl = "jdbc:mysql://192.168.152.102:13308";
		DataSourceInfo dataSourceInfo = new DataSourceInfo();
		dataSourceInfo.setDatabaseType(app.getAppName());
		dataSourceInfo.setDataSourceUrl(app.getAppIp());
		dataSourceInfo.setUsername(app.getUsername());
		dataSourceInfo.setPassword(app.getPassword());

		dataSourceInfo.setDriver(app.getDriver());
		return dataSourceInfo;
	}

}
